package com.jeesite.modules.digitalize.config;

import com.jeesite.modules.swagger.config.SwaggerConfig;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author patronli
 * @Description:
 * @date 2023年08月04日 17:01:44
 */
@Configuration
@ConditionalOnProperty(name = "web.swagger.enabled", havingValue = "true", matchIfMissing = false)
public class CustomApiConfig {

    @Bean
    @ConditionalOnProperty(name = "web.swagger.digitalize.enabled", havingValue = "true", matchIfMissing = true)
    public Docket customApi() {
        String moduleCode = "族库";
        String moduleName = "族库";
        String basePackage = "com.jeesite.modules.digitalize.controller";
        return SwaggerConfig.docket(moduleCode, moduleName, basePackage)
                .select()
                .apis(
//						Predicates.and(Predicates.and(
//						RequestHandlerSelectors.withClassAnnotation(Api.class),
//						RequestHandlerSelectors.withMethodAnnotation(ResponseBody.class)),
//						RequestHandlerSelectors.basePackage(basePackage))
                        RequestHandlerSelectors.basePackage(basePackage)
                ).build();
    }

}
